//
//  ZJCommentCell.m
//  这家测试项目
//
//  Created by IOS_DEVELOPER on 2017/6/29.
//  Copyright © 2017年 陈志凌. All rights reserved.
//

#import "ZJCommentCell.h"

@implementation ZJCommentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.profile_icon.layer.masksToBounds = YES;
    self.profile_icon.layer.cornerRadius = 25;
    self.authenticated.layer.masksToBounds = YES;
    self.authenticated.layer.cornerRadius = 7.5;
    
    self.content.textColor = [Utils colorWithHexString:@"333333"];
    
    self.profile_icon.sd_layout.leftSpaceToView(self.contentView, 13).topSpaceToView(self.contentView, 8).widthIs(50).heightIs(50);
    self.authenticated.sd_layout.leftSpaceToView(self.contentView, 50).topSpaceToView(self.contentView, 40).widthIs(15).heightIs(15);
    self.userName.sd_layout.leftSpaceToView(self.profile_icon, 8).topSpaceToView(self.contentView, 16).rightSpaceToView(self.contentView, 8).autoHeightRatio(0);
    self.content.sd_layout.leftSpaceToView(self.profile_icon, 8).topSpaceToView(self.userName, 16).rightSpaceToView(self.contentView, 8).autoHeightRatio(0);
    self.date.sd_layout.leftEqualToView(self.content).topSpaceToView(self.content, 8).rightSpaceToView(self.contentView, 8).autoHeightRatio(0);
    
}

-(void)setModel:(ZJCommentModel *)model{
    _model = model;
    [self.profile_icon sd_setImageWithURL:[NSURL URLWithString:_model.avatar?:@""] placeholderImage:[UIImage imageNamed:KUserHeadPhoto]];
    self.userName.text = model.username;
    self.content.text = model.content;
    self.date.text = model.date;
    if ([model.authenticated isEqualToString:@"1"]) {
        self.authenticated.image = [UIImage imageWithContentsOfFile:[Utils imgPath:@"pl_icon_sm@3x.png"]];
    }
    [self setupAutoHeightWithBottomView:self.date bottomMargin:8];
}

@end
